<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script src="${ctxStatic}/jquery/jquery-1.9.1.min.js"></script>
<script src="${ctxStatic}/jquery/keyboard.js"></script>
<html>
<head>
<%@ include file="/WEB-INF/views/include/head.jsp"%>
<link rel="stylesheet" href="${ctxStatic}/css/list_erp.css">
<link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
<link rel="stylesheet" href="${ctxStatic}/css/keyboard_style.css">
<style>
	table {
		margin-top: 40px;
		margin-left: 20px;
		border-collapse: separate;
		border-spacing: 0;
		border: 2px #000;
		text-align: center;
        /* margin: 0 auto; */
	}
	table thead tr,table tbody tr {
		height: 50px;
		line-height: 50px;
	}
	table tr th:first-child,table tr td:first-child {/*设置table左边边框*/
		border-left: 2px solid #eaeaea;
	}
	table tr th:last-child,table tr td:last-child {/*设置table右边边框*/
		border-right: 2px solid #eaeaea;
	}
	table tr td:first-child,
	table tr td:nth-child(2),
	table tr td:nth-child(3),
	table tr td:last-child{/*设置table表格每列底部边框*/
		border-bottom: 2px solid #eaeaea;
	}
	table tr th {
		background: #eaeaea;
	}
	table tr:first-child th:first-child {
		border-top-left-radius: 12px;
	}

	table tr:first-child th:last-child {
		border-top-right-radius: 12px;
	}
	table tr:last-child td:first-child {
		border-bottom-left-radius: 12px;
	}

	table tr:last-child td:last-child {
		border-bottom-right-radius: 12px;
	}
</style>
<script type="text/javascript">
	/* 断料保存  */
	function updateStatus(styleId,materialId) {
		/*如果面料总单耗为0*/
		if ($("#materialUnitExpend").val() == "0") {
			/* 面料总单耗为0，不能断料！ */
			alert("<spring:message code='broken_material_alert_cannotBreak'/>");
			return;
		}
		var url = "${ctx}/updateStatus";
		unFormat($("#write"));
		params = {
			"styleId":styleId,
			"materialQuantity":$("#write").val(),
			"materialId":materialId
		}
		$.post(url,params,function(result){
			if (result == "true") {
				tipParent('<spring:message code='broken_material_Success'/>');
				window.parent.searchContact('${makeFlag}');
				closeWin();
            } else {
            	tipParent('<spring:message code='broken_material_Failed'/>');
            }
		});
	}
	/* 断料明细画面  */
	function popBrokenDetail() {
		popup('850px','550px','${ctx}/materialBreakDetail?contactNo=${materialAll.contractCustomEntity.contractNo}&materialName=${materialAll.styleMaterialEntity.materialName}&makeFlag=${makeFlag}&styleIdList='+$("#saveBrokenBtn").val());
	}
	
</script>
</head>
<body>
<div>
<div style="width:100%;background:#595959;padding-left:20px;padding-bottom:10px;box-sizing:border-box;" class="topBtnClose" onclick="closeWin()">
	<span style="font-size:35px;color:white;margin-top:20px;display:inline-block"><spring:message code='title_broken_material'/></span>
</div>
<div class="smOrderBox" style="height: 60%;width: 65%;float: left;">
	<div class="items clearfix" style="padding: 20px 0">
       	<div class="clearfix" style="font-size: 37px;left: 5%;position: relative;">
       	<!-- 合同号 -->
            <p class="tit" style="width: 30%;"><spring:message code='order_contractNo'/>:</p>
            <p>${materialAll.contractCustomEntity.contractNo}</p>
        </div>
	</div>
	<div class="items clearfix" style="padding: 20px 0">
       	<div class="clearfix" style="font-size: 37px;left: 5%;position: relative;">
       	<!-- 物料 -->
            <p class="tit" style="width: 30%;"><spring:message code='materialTemp'/>:</p>
            <p>${materialAll.styleMaterialEntity.materialName}</p>
        </div>
	</div>
	<div class="items clearfix" style="padding: 20px 0;">
       	<div class="clearfix" style="font-size: 37px;left: 5%;position: relative;width: 70%;float: left;height: 10%">
       	<!-- 断料 -->
            <p class="tit" style="width: 43%;"><spring:message code='broken_material'/>:</p>
            <p>${materialAll.materialUnitExpendAll}</p>
            <br>
            <p class="tit" style="width: 43%;">已断:</p>
            <p>${materialUnitExpend-materialAll.materialUnitExpendAll}</p>
            <input type="hidden" id="materialUnitExpend" value="<fmt:formatNumber value='${materialAll.materialUnitExpendAll}' pattern='###0.####' />"/>
        </div>
        	<button style="width:27%;height:60px;float: left;font-size: 32px;border:none;border-radius:5px;margin-bottom:10px;background:#595959;color:#ffffff;"  type="button" value="${materialAll.styleIdList}" onclick="popBrokenDetail();">详细</button>
	</div>
	<div class="items clearfix" style="padding: 20px 0">
       	<div class="clearfix" style="font-size: 37px;left: 5%;position: relative;">
       	<!-- 料头 -->
            <p class="tit" style="width: 30%;top: 12px;position: relative;"><spring:message code='material_remain'/>:</p>
            <input type="text" style="font-size: 35px;width: 36%;height: 14%" id="write" value="" onkeydown="keyLogin(event);"  onfocus="javascript:this.select();"/>
        </div>
	</div>
</div>
<div class="smOrderBox" style="height: 60%;width: 35%;float: left;">
    <div>
        <ul id="keyboard">
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>7</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>8</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>9</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>4</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>5</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>6</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>1</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>2</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>3</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>.</span></li>
            <li class="symbol" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;"><span>0</span></li>
            <li class="delete" style="margin: 0 10px 10px 0;width: 80px;height: 80px;font-size: 30px;">del</li>
        </ul>
    </div>
</div>
<div class="smOrderBox" style="height: 30%;width: 100%;float: left;">
	<div class="" style="left: 32%;top:20%;position: relative;">
		<button id="saveBrokenBtn" style="width:150px;height: 50px;font-size: 32px;border:none;border-radius:5px;margin-bottom:10px;background:#595959;color:#ffffff;"  type="button" value="${materialAll.styleIdList}" onclick="updateStatus(this.value,'${materialAll.styleMaterialEntity.materialId}')"><spring:message code='button_ok'/></button>
		&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;<button style="width:150px;height: 50px;font-size: 32px;border:none;border-radius:5px;margin-bottom:10px;background:#595959;color:#ffffff;"  type="button" value="${materialAll.styleIdList}" onclick="closeWin()"><spring:message code='button_cancel'/></button>
	</div>
</div>
</div>
</body>
</html>